﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace WuLiu.Spider.BLL
{
    [Serializable]
    public class MatchTagAttributeCollection : CollectionBase
    {
        public MatchTagAttribute this[int index]
        {
            get
            {
                return (MatchTagAttribute)this.List[index];
            }
        }

        public int Add(MatchTagAttribute item)
        {
            if (this.Get(item.Name) == null)
                return this.List.Add(item);
            return -1;
        }

        public MatchTagAttribute Get(string name)
        {
            foreach (MatchTagAttribute item in this.List)
            {
                if (string.IsNullOrEmpty(item.Name))
                {
                    continue;
                }

                if (string.Compare(item.Name, name, true) == 0)
                {
                    return item;
                }
            }
            return null;
        }
    }
}
